// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLObject;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "SQLRefreshMaterializedViewStatement.h"
#include "../../visitor/SQLASTVisitor.h"

SQLRefreshMaterializedViewStatement::SQLRefreshMaterializedViewStatement()
{
  this->setConcurrently(BOOL::FALSE);
  this->setWithData(BOOL::FALSE);
  this->setWithNoData(BOOL::FALSE);
}

SQLRefreshMaterializedViewStatement::SQLRefreshMaterializedViewStatement(DbType_ptr dbType)
    : SQLStatementImpl(dbType)
{

  this->setConcurrently(BOOL::FALSE);
  this->setWithData(BOOL::FALSE);
  this->setWithNoData(BOOL::FALSE);
}

// @Override
void SQLRefreshMaterializedViewStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLRefreshMaterializedViewStatement)))
  {
    acceptChild(visitor, name);
  }
  visitor->endVisit(SharedObject(SQLRefreshMaterializedViewStatement));
}

SQLExpr_ptr SQLRefreshMaterializedViewStatement::getName()
{
  return name;
}

void SQLRefreshMaterializedViewStatement::setName(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLRefreshMaterializedViewStatement));
  }
  this->name = x;
}

BOOL_ptr SQLRefreshMaterializedViewStatement::isConcurrently()
{
  return concurrently;
}

void SQLRefreshMaterializedViewStatement::setConcurrently(BOOL_ptr concurrently)
{
  this->concurrently = concurrently;
}

BOOL_ptr SQLRefreshMaterializedViewStatement::isWithNoData()
{
  return withNoData;
}

void SQLRefreshMaterializedViewStatement::setWithNoData(BOOL_ptr withNoData)
{
  this->withNoData = withNoData;
}

void SQLRefreshMaterializedViewStatement::setWithData(BOOL_ptr withData)
{
  this->withData = withData;
}

BOOL_ptr SQLRefreshMaterializedViewStatement::isWithData()
{
  return withData;
}

// @Override
SQLObject_list_ptr SQLRefreshMaterializedViewStatement::getChildren()
{
  SQLObject_list_ptr children = std::make_shared<std::list<SQLObject_ptr>>();
  if (name != nullptr)
  {
    children->push_back(name);
  }
  return children;
}
